<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>  
    <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/server.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<form method="post" action="">
  <div class="panel admin-panel" id="app">
    <div class="panel-head"><strong class="icon-reorder"> 用户管理</strong></div>
    <div class="padding border-bottom">
     <ul class="search">
    
     
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="120">ID</th>
        <th>用户名</th>       
        <th>姓名（昵称）</th>
        <th>性别</th>
        
        <th width="25%">邮箱</th>
         <th width="120">头像</th>
        <th>操作</th> 
      
      </tr>      
        <tr v-for="user  in lists ">
          <td>{{user.id}}</td>
            
          <td>{{user.username}}</td>
          <td>{{user.nickname}}</td>
          <td>{{user.sex}}</td>  
               
          <td>{{user.email}}</td>
          <td><img  v-bind:src="web_static_server+user.header" style="height: 35px;"/></td>
          <td><div class="button-group"> <a class="button border-red" href="javascript:void(0)" v-on:click="del(user.id)" ><span class="icon-trash-o"></span> 删除</a> </div></td>
         
        </tr>
    </table>
  </div>
</form>

</body>


<script type="text/javascript">
	//Hint表示提示对象 ，把提示信息封装到hint对象中
	var vue = new Vue({
		el : '#app',
		data : {
			lists : [],
			web_server:window.web_server,
			web_static_server:this.web_server+"/static/"
		},
		methods : {
			init : function() {
				var _self = this;
				//自定义 一个函数 ，用来查询所有的商品信息，返回Json
				$.get(_self.web_server+"/user/list", function(result) {
					if(result.code=="200"){
						_self.lists = result.data;
					}
				
				}, "json");
			},
			del:function(_id){
				var _self = this;
				if(confirm("您确定要删除吗?")){
					$.get(_self.web_server+"/user/delete",{id:_id}, function(result) {
							if(result.code=="200"){
									window.location.reload();
							}
					
					}, "json");
		
				}
				
			}

		}

	});
	//初始化Vue对象完毕之后，就调用init方法 （一进入页面，就显示数据）
	vue.init();
</script>





</html>